import { BillCodeGeneratorEx } from './../service/tool.service';
import { Config, Controller, Get, Inject } from '@midwayjs/core';

@Controller('/')
export class HomeController {
  @Get('/')
  async home(): Promise<string> {
    return 'Hello world Midwayjs!';
  }
  /* abc: {
    def: ['zhangsan', 'lisi'],
    igh: {
      username: '11',
    },
  }, */
  @Config('abc')
  xxx: any;
  @Config('abc.def')
  yyy: Array<string>;
  @Get('/showConfig')
  async showConfig(): Promise<string> {
    console.log(this.xxx);
    console.log(this.yyy);
    return 'Hello world Midwayjs!';
  }
  @Inject()
  billCodeGeneratorEx: BillCodeGeneratorEx;
  @Get('/testCode')
  async testCode() {
    const a = await this.billCodeGeneratorEx.nextCode('WE');
    const b = await this.billCodeGeneratorEx.nextCode('WT');
    const c = await this.billCodeGeneratorEx.nextCode('UO');
    return [a, b, c];
  }
}
